home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / termsorc.lha / Extras / Source / gtlayout-source.lha / LTP_HexEditRoutine.c < prev    next >
C/C++ Source or Header  |  1995-09-24  |  1KB  |  67 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. #ifdef DO_HEXHOOK
  10. ULONG __asm __saveds
  11. LTP_HexEditRoutine(register __a0 struct Hook *hook,register __a2 struct SGWork *sgw,register __a1 ULONG *msg)
  12. {
  13.     ULONG result = FALSE;
  14.  
  15.     if(*msg == SGH_KEY)
  16.     {
  17.         BOOLEAN      activate    = TRUE;
  18.         LayoutHandle    *handle     = hook -> h_Data;
  19.         ObjectNode    *node;
  20.  
  21.         if(sgw -> IEvent -> ie_Code == 0x5F && handle -> HelpHook)
  22.         {
  23.             sgw -> Code    = 0x5F;
  24.             sgw -> Actions    = (sgw -> Actions & ~SGA_BEEP) | SGA_END | SGA_USE;
  25.  
  26.             LTP_AddHistory(sgw);
  27.  
  28.             return(TRUE);
  29.         }
  30.  
  31.         if(sgw -> IEvent -> ie_Code == CURSORUP || sgw -> IEvent -> ie_Code == CURSORDOWN)
  32.             LTP_HandleHistory(sgw);
  33.  
  34.         if(GETOBJECT(sgw -> Gadget,node))
  35.         {
  36.             if(node -> Type == INTEGER_KIND)
  37.             {
  38.                 if(node -> Special . Integer . LastGadget)
  39.                     activate = FALSE;
  40.  
  41.                 result = TRUE;
  42.  
  43.                 if(!LTP_ConvertNum((node -> Min < 0),sgw -> WorkBuffer,(LONG *)&sgw -> StringInfo -> LongInt))
  44.                 {
  45.                     sgw -> EditOp    = EO_BADFORMAT;
  46.                     sgw -> Actions    = SGA_BEEP;
  47.                 }
  48.             }
  49.         }
  50.  
  51.         if(sgw -> EditOp == EO_ENTER && !(sgw -> IEvent -> ie_Qualifier & QUALIFIER_SHIFT))
  52.         {
  53.             if(activate && handle -> AutoActivate)
  54.                 sgw -> Actions |= SGA_NEXTACTIVE;
  55.  
  56.             if(!(sgw -> Actions & SGA_NEXTACTIVE))
  57.                 sgw -> Code = '\r';
  58.         }
  59.  
  60.         if(sgw -> Actions & SGA_END)
  61.             LTP_AddHistory(sgw);
  62.     }
  63.  
  64.     return(result);
  65. }
  66. #endif
  67.